package com.hpf.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @description: 上下文配置
 * @datetime: 2020/8/18 22:28
 * @author: huangpengfei
 */
@Configuration
public class ApplicationContextConfig {

    /**
     * 注入调用模板，注解开启负载均衡调用不同机器的服务
     * @return org.springframework.web.client.RestTemplate
     * @author  huangpengfei
     * @datetime  2020/8/18 22:29
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
